-
Notifications
You must be signed in to change notification settings - Fork 199
feat: add MFA authentication support to snowflake integration #2305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add MFA authentication support to snowflake integration #2305
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for your effort and contribution, @ChinmayBansal! I left a few comments, but overall this looks great. Would you mind moving the authentication code to a separate file outside of the main component to help keep things tidy? Also, were you able to test JWT and OAuth with real credentials?
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Outdated
Show resolved
Hide resolved
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Outdated
Show resolved
Hide resolved
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Outdated
Show resolved
Hide resolved
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Outdated
Show resolved
Hide resolved
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Show resolved
Hide resolved
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Outdated
Show resolved
Hide resolved
@ChinmayBansal are you still working on this? |
@medsriha Yes, I am. Will have updates shortly. |
@medsriha |
Hey @medsriha, I have addressed your feedback and tested my solution. I moved my solution to a different file: auth.py. I use the snowflake-connector-python directly. I tested with real Snowflake credentials and it worked. The OAuth authentication implementation is complete but I was not able to test it because it requires accountadmin privileges which I do not have access to and it needs token exchange flow. I think that JWT is Snowflake's recommended approach for MFA access. Could you review? |
Thank you @ChinmayBansal, I'll review this and try to test it with real credentials. Keep you posted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChinmayBansal, nice work! I left you a few comments.
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Outdated
Show resolved
Hide resolved
integrations/snowflake/src/haystack_integrations/components/retrievers/snowflake/auth.py
Outdated
Show resolved
Hide resolved
integrations/snowflake/src/haystack_integrations/components/retrievers/snowflake/auth.py
Outdated
Show resolved
Hide resolved
integrations/snowflake/src/haystack_integrations/components/retrievers/snowflake/auth.py
Outdated
Show resolved
Hide resolved
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Outdated
Show resolved
Hide resolved
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Outdated
Show resolved
Hide resolved
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Show resolved
Hide resolved
integrations/snowflake/src/haystack_integrations/components/retrievers/snowflake/auth.py
Show resolved
Hide resolved
integrations/snowflake/src/haystack_integrations/components/retrievers/snowflake/auth.py
Show resolved
Hide resolved
@medsriha, I have addressed your changes and also updated dependencies in the pyproject.toml file. Could you review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ChinmayBansal — I left a few comments, nothing major. When you get a chance, could you also add some more unit tests? Current coverage is at 79%, and we aim to keep it closer to 90%. You can check coverage locally by running:
hatch -e test run all --cov=haystack_integrations tests/test_snowflake_table_retriever.py
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Outdated
Show resolved
Hide resolved
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Outdated
Show resolved
Hide resolved
...flake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py
Outdated
Show resolved
Hide resolved
@medsriha I have added more unit test cases and the coverage is now 93-94%. I also created a test_auth file to make the code a little bit more maintainable. Let me know if more changes are needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💯
Related Issues
Proposed Changes:
This PR implements multi-factor authentication (MFA) support for the Snowflake
integration to address Snowflake's enhanced security requirements that mandate
MFA for connections. The implementation adds non-interactive authentication
methods while maintaining full backward compatibility.
Key Features Added:
environment variables, eliminating user prompts as specifically requested
remains unchanged with no breaking changes
How did you test it?
tests passing)
validation
Notes for the reviewer
(lines ~257-301)
(lines ~152-185)
sensitive data never appears in logs
prompts" requirement
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.